package com.liwei.listener;

import net.sf.ehcache.CacheException;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import net.sf.ehcache.event.CacheEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SysCacheEventListener implements CacheEventListener {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException {
        logger.info("====================CacheEventListener Removed"+":"+cache.getName()+ ":"+element.toString());
    }

    @Override
    public void notifyElementPut(Ehcache cache, Element element) throws CacheException {
        logger.info("====================CacheEventListener Put"+":"+cache.getName()+":"+element.toString());
    }

    @Override
    public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException {
        logger.info("====================CacheEventListener Updated"+":"+cache.getName()+":"+element.toString());
    }

    @Override
    public void notifyElementExpired(Ehcache cache, Element element) {
        logger.info("====================CacheEventListener Expired"+":"+cache.getName()+":"+element.toString());
    }

    @Override
    public void notifyElementEvicted(Ehcache cache, Element element) {
        logger.info("====================CacheEventListener Evicted"+":"+cache.getName()+":"+element.toString());
    }

    @Override
    public void notifyRemoveAll(Ehcache cache) {
        logger.info("====================CacheEventListener RemoveAll"+":"+cache.getName());
    }

    @Override
    public void dispose() {
        logger.info("CacheEventListener ====================dispose");
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return null;
    }
}
